/*
*  Copyright (c) 2006-2020, Chukie
*  
*  SPDX-License-Identifier: Apache-2.0
*  
*  @file     : 
*  
*  @brief    : 
*  Website   : https://gitee.com/zcj20080882
*  
*  
*  Change Logs:
*  Date           Author          Notes
*  2021-02-05     zhaocj       The first version
*/
/* Define to prevent recursive inclusion ------------------------------------*/
#ifndef __SMS_PDU__
#define __SMS_PDU__
/* Includes -----------------------------------------------------------------*/
#include <rtthread.h>
#include <stdint.h>
/* Exported types -----------------------------------------------------------*/
/*短信编码*/
typedef enum{
    SMS_ENCODE_TEXT = 0,
    SMS_ENCODE_UCS2,
}sms_encode_t;

/*短信状态*/
typedef enum{
    SMS_REC_UNREAD = 0,
    SMS_REC_READ,
    SMS_STO_UNSENT,
    SMS_STO_SENT
}sms_state_t;

/*PDU 短信编码*/
typedef enum {
    /*GSM 7bit 编码*/
    PDU_DCS_GSM = 0x00,
    /*8bit 编码*/
    PDU_DCS_8BIT = (1 << 2),
    /*UCS2 编码*/
    PDU_DCS_UCS2 = (1 << 3)
} sms_pdu_dcs_t;

/**
 * @brief 短信接收回调
 * 
 * @param sms content   
 * @param sms content length
 * @param sender    phone number of sender
 * @param encoding  reference to sms_encode_t
 * @param state     reference to sms_state_t
 * 
 * @return
 *          
 */
typedef int (*sms_rcv_callback_t)(char * /*sms content*/,int /*sms content length*/,char * /*sender*/,sms_encode_t /*encoding*/,sms_state_t /*state*/);

/* Exported constants -------------------------------------------------------*/
/* Exported macro -----------------------------------------------------------*/
/* Exported functions -------------------------------------------------------*/
int sms_pdu_parse(char *pdu_str, sms_rcv_callback_t cb);
int ASCII2GSM7bit(unsigned char *pSrc, int srcLen, int isLongSMS);
int StringHex2ByteHex(const char *string, int string_len, unsigned char *hex, \
    int hex_len);
#endif /*__SMS_PDU__*/
/* End of file****************************************************************/



